Release 10.1A: OpenEdge Data Management:
DataServer for ORACLE
Run Stored-Proc statement with send-sql-statement option
The Progress 4GL also allows you to use stored-procedure syntax to send SQL statements and their native language extensions directly to a data source. The DataServer uses the
RUNSTORED–PROCEDUREstatement with thesend–sql–statementoption to pass SQL statements to the data source. However, the ORACLE DataServer only supports one SQL statement or PL/SQL block with the send-sql-statement option.Like the option to define a
RUN STORED-PROCstatement either with or without theLOAD-RESULT-INTOoptions, you can define a send-sql-statement option with or without theLOAD-RESULT-INTOoption. The following section presents and briefly describes an example use of each technique.Without the Load-Result-Into option
You use the
RUNSTORED–PROCstatement with thesend–sql–statementoption and pass the PL/SQL statements as a parameter. The syntax of the statement must be valid PL/SQL syntax. Example 3–1 shows how the code presented passes aSELECTstatement as a parameter.
Example 3–1: Passing a SELECT statement as a parameterThis example returns the
name of allcustomerswhosenamebegins with A. You must read the results into a buffer as you would with a stored procedure called by a Progress procedure. You can read the results into theproc–text–bufferdefined by Progress as shown in the example above. Alternatively, you can define your own buffer from within your data source that can accept other data type as well as theCHARACTERdata type.With the Load-Result-Into option
Example 3–2 shows how to use the send-sql-statement option with the
LOAD-RESULT-INTOoption. It also shows that thePROC-STATUSphrase must be defined as part of theRUN STORED-PROCstatement because of the implicitCLOSE STORED-PROCthat is associated with theLOAD-RESULT-INTOphrase.
Example 3–2: Using the send-sql-statement option with LOAD-RESULT-INTO optionIn the previous example, also note that the
PROC-STATUSphrase does not need aPROC-HANDLEphrase because it is retrieved using theRUN STORED-PROCstatement; although thePROC-HANDLEis typically used after the execution of theRUN STORED-PROCstatement, it is not needed in this context.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |